package com.neusoft.bizcore.notice.notification.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractAuditModel;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "neuiot_notice_template")
@org.hibernate.annotations.Table(appliesTo = "neuiot_notice_template", comment = "通知模板表")
public class NoticeTemplate extends AbstractAuditModel {

    private static final long serialVersionUID = 1L;

    @NotBlank(message = "通知模板编码不能为空")
    @Length(max = 255, message = "通知模板编码不能超过{max}位")
    @Column(length = 255, nullable = false)
    private String code;

    @NotBlank(message = "通知模板名称不能为空")
    @Length(max = 255, message = "通知模板名称不能超过{max}位")
    @Column(length = 255, nullable = false)
    private String name;

    @NotBlank(message = "通知模板类型不能为空")
    @Length(max = 255, message = "通知模板类型不能超过{max}位")
    @Column(length = 255, nullable = false)
    private String type;

    @OneToOne(mappedBy = "noticeTemplate", cascade = CascadeType.ALL)
    private NoticeTemplateAttachment template;

}
